import request from '@/utils/request'

// 分页查询预约记录
export function searchReservations(params) {
    return request({
        url: '/seat/search',
        method: 'get',
        params
    })
}

// 预约座位
export function reserveSeat(data) {
    return request({
        url: '/seat/reserve',
        method: 'post',
        data
    })
}

// 取消预约
export function cancelReservation(data) {
    return request({
        url: `/seat/cancel/${data.id}`,
        method: 'post',
        params: { userId: data.userId }
    })
}

// 签到
export function checkIn(data) {
    return request({
        url: `/seat/checkin/${data.id}`,
        method: 'post',
        params: { userId: data.userId }
    })
}

// 签退
export function checkOut(data) {
    return request({
        url: `/seat/checkout/${data.id}`,
        method: 'post',
        params: { userId: data.userId }
    })
}

// 获取用户当前预约
export function getCurrentReservation(userId) {
    return request({
        url: `/seat/current/${userId}`,
        method: 'get'
    })
}

// 获取用户所有预约
export function getUserReservations(userId) {
    return request({
        url: `/seat/user/${userId}`,
        method: 'get'
    })
}

// 获取预约总数
export function getReservationCount() {
    return request({
        url: '/seat/count',
        method: 'get'
    })
}